/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controladores;

import entidades.DatosGeneralesConvenioView;
import javax.ejb.EJBException;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author BATAQUERO
 */
@Stateless
public class DatosGeneralesConvenioViewFacade extends AbstractFacade<DatosGeneralesConvenioView> implements DatosGeneralesConvenioViewFacadeLocal {
    @PersistenceContext(unitName = "KonbitacoraPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public DatosGeneralesConvenioViewFacade() {
        super(DatosGeneralesConvenioView.class);
    }

    @Override
    public DatosGeneralesConvenioView consultarDatosGeneralesConvenioXEstudiante(Integer idEstudiante) {
        try {
            Query q = em.createNamedQuery("DatosGeneralesConvenioView.findByIdEstudiante");
            q.setParameter("idEstudiante", idEstudiante);
            DatosGeneralesConvenioView datosGeneralesConvenioView = (DatosGeneralesConvenioView) q.getSingleResult();
            return datosGeneralesConvenioView;
        } catch (EJBException eJBException) {
            return null;
        } catch (NoResultException noResultException) {
            return null;
        }
    }
    
}
